#ifndef MULTICASTSERVER_CPP
#define MULTICASTSERVER_CPP

#include "../Common/Playlist.h"
#include "../Common/Observer.h"
#include "../Common/Socket.h"
#include "../Common/AudioSystem.h"
#include "../Common/Runnable.h"
#include "../Common/RecordSystem.h"
#include <string>

#define BUFSIZE 8192
#define HEADERSIZE 23

#define MCPORT 9035

/*-------------------------------------------------------------------------------------------
--
--	CLASS: MulticastServer
--
--	Date: March 25, 2010
--
--	REVISIONS (Date and Description):
--
--	DESIGNER: Brad Paugh, Renz Barron
--
--	PROGRAMMER: Brad Paugh, Renz Barron
--
--  INTERFACE: class MulticastServer : public Runnable, public Observer
--
--  RETURNS: N/A
--
--	NOTES: Program class for the Multicast Server. Sends song/microphone data to all
--         connected clients.
--
-------------------------------------------------------------------------------------------*/
class MulticastServer : public Runnable, public Observer
{
    public:
        MulticastServer (Playlist * thePlaylist);
        void runServer ();
        void notify (Observable *observable, int eventCode);
        void sendPacket (char* packet, int packetSize);
        void toggleMic (bool on);

    private:
        Playlist * playlist;
        Socket sock;
		unsigned long totalBytesRead;
		AudioSystem* as;
		std::string fileName;
		char* header;
        bool microphone;
        void run();
		void runPlaylist();
		void recordMic();
};

#endif
